<?php
/**
 * Created by PhpStorm.
 * User: 庆金
 * Date: 2019-12-12
 * Time: 23:39
 */
$http = new swoole_http_server("0.0.0.0",8811);
$http->set([
    'enable_static_handler' => true,
    'document_root' =>  '/var/www/html/swoole/data',
]);
$http->on('request',function ($request,$response){
//    print_r($request->get);
    $response->cookie("singwa","xssss",time() + 1800);
    $response->end("
<html>
<head>
<meta charset='utf-8'/>
<title>swoole的http案例</title>
</head>
<body>
<h1>获取结果</h1>
<p>".json_encode($request->get)."</p>
</body>
</html>

    ");
});
$http->start();